/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.ui.rich.prep.view.dialog;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.WindowEvent;

import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import br.ufmg.dees.insane.ui.rich.prep.view.DesktopPrep;

/**
 * A class representing console dialog on desktop.<br>
 * @author Ferreira, Reginaldo & Pitangueira, Roque
 * @since october 2006
 */
public class TextAreaDialog extends JDialog {
	
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;
	private DesktopPrep parent;
	private JTextArea output;
	private Container tela;
	
//*****************************************************************************
	
	public TextAreaDialog(DesktopPrep owner, String title, boolean modal, JTextArea ta)
	{
		super(owner, title, modal);
		
		parent = owner;
		
		output = new JTextArea(25, 100);
		output.setEditable(true);
		output.setLineWrap(true);
		output.setEditable(false);
		output.setText(ta.getText());
		output.setCaretPosition(output.getText().length());

		JScrollPane scroller = new JScrollPane(output, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		scroller.setBorder(BorderFactory.createLoweredBevelBorder());
		
        tela = getContentPane();
        tela.setLayout(new BorderLayout());
        tela.add(BorderLayout.CENTER,  scroller);

        setSize(parent.getDesktop().getWidth()-50, parent.getDesktop().getHeight()-50);
        setLocationRelativeTo(parent);
        setVisible(true);   
		
	}
	
//	****************************************************************************
	
    public void windowClosing (WindowEvent e)
    { 
    	System.exit(0); 
    } 

//  ****************************************************************************
}
